package com.rst.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rst.dao.TeacherDAO;
import com.rst.model.Teacher;

@Service
public class TeacherService {

	@Autowired
	private TeacherDAO teacherDAO;
	

	public void saveTeacher(Teacher teacher) {
		teacherDAO.saveTeacher(teacher);
	}

	public Teacher getTeacherById(Long teacherId) {
		return teacherDAO.getTeacherById(teacherId);		
		
	}

	public List<Teacher> getTeacherList() {
		return teacherDAO.getTeacherList();	
	}

	public String deleteTeacher(Long teacherId) {
		Teacher teacher  = teacherDAO.getTeacherById(teacherId);
		teacher.setStatus(Teacher.INACTIVE);
		teacherDAO.saveTeacher(teacher);
		return "success";
	}


	
}
